<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>模版语法</title>
</head>

<body>
    <!-- 
        模版的理解：
        动态的html页面
        包含了一些js语法代码：
            双大括号表达式
            指令
     -->
    <div id="app">
        <!--view-->
        <h2>1.双大括号表达式</h2>
        <p>{{msg}}</p>
        <p>{{msg.toUpperCase()}}</p>

        <h2>2.指令一：强制数据绑定 v-bind(直接写:)</h2>
        <img v-bind:src="imgUrl">
        <img :src="imgUrl">

        <h2>3.指令二：绑定事件监听v-on(直接写@)</h2>
        <button v-on:click="test">test1</button>
        <button @click="test">test1</button>
        <button @click="test2(msg)">test2</button>
    </div>
    <script src="https://cdn.bootcss.com/vue/2.5.16/vue.js"></script>
    <script>
        var app = new Vue({
            el: '#app',
            data: {
                msg: 'I will back',
                imgUrl: 'https://cn.vuejs.org/images/logo.png'
            },
            methods: {
                test() {
                    alert('hehe')
                },
                test2(content) {
                    alert(content)
                }
            }
        })
    </script>
</body>

</html>